package com.example.controller;

import com.example.entity.Admin;
import com.example.service.AdminService;
import com.example.utils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "管理员管理") //swagger的注释
@CrossOrigin
@RequestMapping("/admin")
@RestController
public class AdminController {

    @Autowired
    private AdminService adminService;

    @ApiOperation(value = "修改密码")
    @PostMapping("updateAdmin")
    public R updateAdmin(@RequestBody Admin admin){
        boolean b = adminService.updateById(admin);
        if (b) {
            return R.ok();
        } else {
            return R.error();
        }
    }

}
